/*
 * Copyright (C) 2007-2008  Hylke van der Schaaf
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package hextd;

import java.awt.Color;

/**
 * Constants used by HexTD
 */
public class Constants {

	/**
	 * Error types that the server can issue
	 */
	public static enum ErrorType {

		Unknown,
		AuthFailed,
		ReplayLoadFailed
	}

	/**
	 * Game settings types.
	 */
	public static enum settingKey {

		ladderGame,
		openGame,
		pause,
		publicGame,
		ready,
		selectedMap,
		mapMD5,
		version
	}

	/**
	 * Types of fetch messages
	 */
	public enum FetchType {

		mp,
		sp,
		maplist,
		map
	}

	/**
	 * Game colors of creeps and towers
	 */
	public static enum COLOR {

		RED,
		GREEN,
		BLUE,
		YELLOW,
		OTHER
	}

	/**
	 * Damage types of the different towers
	 */
	public static enum DamageType {

		normal,
		speed,
		power,
		time
	}

	public static enum Direction {

		NORTH,
		EAST,
		SOUTH,
		WEST,
		UP,
		DOWN,
		LEFT,
		RIGHT
	}
	/**
	 * Key for the credit resource
	 */
	public static String RESOURCE_CREDIT = "c";
	/**
	 * Key for the bonus-point resource
	 */
	public static String RESOURCE_BONUS = "b";
	/**
	 * Key for the score "resource". Not really a resource, but the score
	 * rewarded for killing stuff.
	 */
	public static String RESOURCE_SCORE = "s";
	/*
	 * Colors used by HexTD
	 */
	public static Color colorBaseBackGround;
	public static Color colorOpenBackGround;
	public static Color colorBaseHexBorder;
	public static Color colorBaseHexBackGround;
	public static Color colorBaseEmptyHexBorder;
	public static Color colorHighlightOK;
	public static Color colorHighlightNOK;
	public static Color colorRangeCircle;
	public static Color colorHealthLine;
	public static Color colorForeGround;
	public static Color colorForeGroundPale;
	public static Color colorBackGround = Color.BLACK;
	public static Color colorBackGroundDark = Color.BLACK;
	public static Color[] playerColors = {
		new Color(255, 100, 100),
		new Color(100, 255, 100),
		new Color(100, 100, 255),
		new Color(255, 255, 100),
		new Color(255, 100, 255),
		new Color(100, 255, 255),
		new Color(255, 000, 000),
		new Color(000, 255, 000),
		new Color(000, 000, 255),
		new Color(255, 255, 000),
		new Color(255, 000, 255),
		new Color(000, 255, 255)
	};
	public static Color[] playerColorsAlpha50;

	public static Color getColorPlayer(int player) {
		if (player >= playerColors.length) {
			player %= playerColors.length;
		}
		return playerColors[player];
	}

	public static Color getColorPlayerAlpha(int player) {
		if (player >= playerColorsAlpha50.length) {
			player %= playerColorsAlpha50.length;
		}
		return playerColorsAlpha50[player];
	}
}
